<fieldset>
    <legend>条件搜索</legend>
    <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
        <div class="layui-form-item layui-inline">
            <label class="layui-form-label">柜点名称</label>
            <label class="layui-input-inline">
                <select class="layui-select" lay-search name="s_id">
                    <option value=''>- 全部 -</option>
                    {foreach $stores as $k=>$v}
                    {if input('s_id') eq $k.''}
                    <option selected value="{$k}">{$v.name}</option>
                    {else}
                    <option value="{$k}">{$v.name}</option>
                    {/if}{/foreach}
                </select>
            </label>
        </div>

        <div class="layui-form-item layui-inline">
            <label class="layui-form-label">柜子名称</label>
            <label class="layui-input-inline">
                <select class="layui-select" lay-search name="d_id">
                    <option value=''>- 全部 -</option>
                    {foreach $devices as $k=>$v}
                    {if input('d_id') eq $k.''}
                    <option selected value="{$k}">{$v.device_name}</option>
                    {else}
                    <option value="{$k}">{$v.device_name}</option>
                    {/if}{/foreach}
                </select>
            </label>
        </div>

        <div class="layui-form-item layui-inline">
            <label class="layui-form-label">订单状态</label>
            <label class="layui-input-inline">
                <select class="layui-select" name="status">
                    <option value=''>- 全部 -</option>
                    {foreach $arr_status as $k=>$v}
                    {if $status eq $k.''}
                    <option selected value="{$k}">{$v}</option>
                    {else}
                    <option value="{$k}">{$v}</option>
                    {/if}{/foreach}
                </select>
            </label>
        </div>

        <div class="layui-form-item layui-inline">
            <label class="layui-form-label">手机号或昵称</label>
            <label class="layui-input-inline">
                <input name="title" value="{:input('title','')}" placeholder="请输入手机号或用户昵称" class="layui-input">
            </label>
        </div>

        <div class="layui-form-item layui-inline">
            <label class="layui-form-label">订单号</label>
            <label class="layui-input-inline">
                <input name="order_no" value="{:input('order_no','')}" placeholder="请输入订单号" class="layui-input">
            </label>
        </div>

        <div class="layui-form-item layui-inline">
            <label class="layui-form-label">ID</label>
            <label class="layui-input-inline">
                <input name="id" value="{:input('id','')}" placeholder="请输入订单ID" class="layui-input">
            </label>
        </div>

        <div class="layui-form-item layui-inline">
            <label class="layui-form-label">创建时间</label>
            <div class="layui-input-inline">
                <input data-date-range name="create_at" value="{:input('get.create_at')}" placeholder="请选择创建时间" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item layui-inline">
            <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
            <button type="button" data-form-export="{:url('index')}" class="layui-btn layui-btn-primary">
                <i class="layui-icon layui-icon-export"></i> 导 出
            </button>
        </div>
    </form>
</fieldset>

<script>
    window.form.render();
    require(['excel'], function (excel) {
        excel.bind(function (data) {
            data.forEach(function (item, index) {
                data[index] = [
                    item.order_no,
                    item.nickname,
                    item.mobile_str,
                    item.device_name,
                    item.box_num,
                    item.fee_type_str,
                    item.amount,
                    item.money,
                    item.amount_total,
                    item.create_time,
                    item.reality_end_time,
                    item.status_str,
                ];
            });
            data.unshift(['订单号', '用户昵称', '手机号', '设备名称', '箱门号', '收费方式', '单价', '已付款', '订单总额', '开始时间', '结束时间', '订单状态']);
            return data;
        }, '用户订单记录');
    });
</script>
